# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.shortcuts import render
from django.http import HttpResponse
from models import BookInfo
import json

# Create your views here.
def index(request):
	booklist = BookInfo.objects.all()
	return render(request,'booktest/index.html',{'booklist': booklist})

def detail(reqeust, id):
    book = BookInfo.objects.get(pk=id)
    return render(reqeust, 'booktest/detail.html', {'book': book})

def readdata(index):
	with open ('/Users/mac/Desktop/gitlearn/data/database/urls.json') as f:
		jsondic = json.load(f)
	return jsondic